package org.example.mine.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.example.model.domain.express.ExpressDetial;
import org.example.model.domain.mine.ExpressExchange;
import org.example.model.domain.mine.ExpressPaymentRecords;
import org.example.model.domain.mine.ExpressRechargeRecord;

import java.util.Date;
import java.util.List;

@Mapper
public interface TopUpMapper {

    @Select("select * from express_recharge_record where register_ip=#{registerIp} order by over_time asc")
    List<ExpressRechargeRecord> selectTopUpList(Long registerIp);

    @Select("select * from express_recharge_record where id=#{id}")
    ExpressRechargeRecord gettopupbyid(Long id);

    @Select("select * from express_exchange where status=1")
    ExpressExchange getexchange();

    int addTopupOrder(ExpressRechargeRecord expressRechargeRecord);

    void topupfail(ExpressRechargeRecord expressRechargeRecord);

    void alipaycallback(ExpressRechargeRecord expressRechargeRecord);

    @Update("update express_detial set account_balance=#{accountBalance} where register_ip=#{registerIp}")
    void updateUserBalance(ExpressDetial expressDetial);

    void addPayOrder(ExpressPaymentRecords expressPaymentRecords);

    @Select("select * from express_detial where register_ip=#{id}")
    ExpressDetial getexpressdetail(String id);

    @Select("select * from express_recharge_record where transaction_number=#{transactionNumber}")
    ExpressRechargeRecord selectorder(String transactionNumber);

    @Update("update express_recharge_record set status=4,over_time=#{date} where id=#{id}")
    void topupfila(Integer id, Date date);
}
